﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using TraceabilityApp_Api.Application.Command.Breed_养殖_;
using TraceabilityApp_Api.DTO;
using TraceabilityApp_ErrorCode;

namespace TraceabilityApp_Api.Controllers
{
    /// <summary>
    /// 溯源养殖信息控制器
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class BreedController : ControllerBase
    {
        private readonly IMediator mediator;

        public BreedController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 溯源养殖信息添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddBreed(AddBreedCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 溯源养殖信息列表查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<BreedDTO>> GetBreed([FromQuery]GetBreedCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 溯源养殖信息修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> UpdateBreed(UpdateBreedCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖保健信息添加
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddHealthcare(AddHealthcareCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖保健信息查询显示
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<HealthcareDTO>> GetHealthcare([FromQuery]GetHealthcareCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖保健信息删除
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<int>> DelHealthcare([FromQuery]DelHealthcareCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖保健信息修改
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> UpdateHealthcare(UpdateHealthcareCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖企业信息添加
        /// </summary>
        /// <param name="request">请求</param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> AddFirm(AddFirmCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖企业信息修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<ApiResult<int>> UpdateFirm(UpdateFirmCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 养殖企业信息显示
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<FirmDTO>> GetFirm([FromQuery]GetFirmCommand request)
        {
            return mediator.Send(request);
        }
    }
}
